<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    
    <!-- 2-1.导入css -->
    <style type="text/css">
    .layadmin-user-login
    {
       min-height:0px!important;
       padding-bottom:0px!important;
       padding-top:60px!important;
    }
    </style>
  <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
  <link rel="stylesheet" href="../../layuiadmin/style/login.css" media="all">
</head>
<body>
    <div id="headerpage" style="width:100%;height:154px;">
	<!--这个div是为了引入header.html头部-->
    </div> 
    <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">
    <div class="layadmin-user-login-main">
      <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
          <input type="text" name="useemail" id="LAY-user-login-username" lay-verify="email" placeholder="请输入邮箱账号" class="layui-input">
        </div>
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
          <input type="password" name="usepassword" id="LAY-user-login-password" lay-verify="required" placeholder="请输入密码" class="layui-input">
        </div>
         <div class="layui-form-item" style="margin-bottom: 20px;">
          <a href="/user/regist" class="layadmin-user-jump-change layadmin-link" style="margin-top: 7px;float:left;">注册帐号</a>
          <a href="/user/user_forgetPasswd" class="layadmin-user-jump-change layadmin-link" style="margin-top: 7px;">忘记密码？</a>
        </div> 
        <div class="layui-form-item">
          <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit" onclick="saveUserInfo()">登 入</button>
        </div>
      </div>
    </div>
  </div> 
    <iframe id="footerWrap"  width="100%" height="80px"  scrolling="no" frameborder="0"  src="/footer" noresize="noresize" style="position:absolute;top:90%;"/></iframe>
</body>

<!-- 2-2.导入js -->

<script src="../layuiadmin/layui/layui.js"></script>  
<script>
  
  layui.config({
    base: '../layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'form','table', 'laydate'], function(){
    var table = layui.table
    ,form = layui.form
    ,$ = layui.$
    ,admin = layui.admin;
    $("#headerpage").load("/header");
    $(document).ready(function () {  
        if (window != top) {  
        	//实际使用时记得删除该代码
            layer.msg('安全登录已经到期，请重新登录！', {
              offset: '15px'
              ,icon: 1,
              time: 2000
            });
        	
        	setTimeout(function(){
        		
        		top.location.href = location.href; 
			},800);
             
        }  
    }); 
    form.on('submit(LAY-user-login-submit)', function(obj){
    	var field = obj.field;
    	$.ajax({
    		      url: '/incubator/login',
    		      type: 'POST',
    		  	  data:{useemail:field.useemail,usepassword:field.usepassword},
    		      success: function (data) {
    	   		   if(data=='用户登录成功')
    	   			 {
	    	   			layer.msg('登录成功', {
	                        offset: '15px'
	                        ,icon: 6
	                        ,time: 1000
	                    }, function(){
	                        location.href = '/index'; //跳转到用户主页
	                    });
    	   			 }
    	   		   else if(data=='管理员登录成功')
    	   			 {
	    	   			layer.msg('登录成功', {
	                        offset: '15px'
	                        ,icon: 6
	                        ,time: 1000
	                    }, function(){
	                        location.href = '/admin'; //跳转到管理员主页
	                    });
    	   			 }
    	   		   else if(data=='审核暂未通过，请联系管理员后再尝试登录')
    	   		   {
    	   			layer.msg('审核暂未通过，请联系管理员后再尝试登录', {
                        offset: '15px'
                        ,icon: 5
                        ,time: 3000
                    }, function(){
                        location.href = '/user/login'; //跳转到登陆页
                    });
    	   		   }
    	   		   else 
    	   			 {
	    	   			layer.msg('账号或密码错误',{
	                        offset: '15px'
	                        ,icon: 5
	                        ,time: 1000
	                    });
    	   			 }
    		      }
    	}) 
    	 return false;
    });
  });
  </script>
</html>